package com.xxx;

import java.io.DataOutputStream;

import java.io.IOException;
import java.io.OutputStream;

import java.net.Socket;
import java.util.Scanner;

public class ClientA {




    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Thread serverA = new ServerA();
        serverA.start();
        while (true) {
            Socket A = null;
            try {
                A =new Socket("127.0.0.1", 8888);

                OutputStream os = A.getOutputStream();
                DataOutputStream dos = new DataOutputStream(os);
                while (true) {
                    String rd = sc.next();
                    if ("exit".equals(rd)){
                        System.out.println("退出成功");

                        A.close();

                        dos.close();
                        return;
                    }
                    dos.writeUTF("客户端A："+rd);
                    dos.flush();
                }


            } catch (Exception e) {

            }
        }


    }
}
